package com.hoshiicloud.commissioncalculation.controller;


import com.hoshiicloud.commissioncalculation.entity.CashRecord;
import com.hoshiicloud.commissioncalculation.feign.WithdrawFeignService;
import com.hoshiicloud.commissioncalculation.param.CashApplyParam;
import com.hoshiicloud.commissioncalculation.service.CashRecordService;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.withdraw.param.ContractPlatformParam;
import com.hoshiicloud.withdraw.param.SubscriptionInformatioParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import com.hoshiicloud.common.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 提现申请(CashRecord)表控制层
 *
 * @author makejava
 * @since 2019-09-09 10:18:01
 */
@RestController
@RequestMapping("/cashRecord")
@Slf4j
public class CashRecordController extends BaseController {
    /**
     * 服务对象
     */
    @Autowired
    private CashRecordService cashRecordService;

    @Autowired
    private WithdrawFeignService withdrawFeignService;


    /**
     * 查询是否签约
     *
     * @param param
     */
    @PostMapping("/subscriptionInformation")
    @ApiOperation(value = "查询是否签约")
    public Response<Boolean> subscriptionInformation(@RequestBody SubscriptionInformatioParam param) {
        return withdrawFeignService.subscriptionInformation(param);
    }


    /**
     * 进行签约
     *
     * @param param
     */
    @PostMapping("/contractPlatform")
    @ApiOperation(value = "进行签约")
    public Response<String> contractPlatform(@RequestBody ContractPlatformParam param) {
        return withdrawFeignService.contractPlatform(param);
    }

    /**
     * 提现申请
     *
     * @param param
     */
    @PostMapping("/cashApply")
    @ApiOperation(value = "提现申请")
    public Response<CashRecord> cashApply(@RequestBody CashApplyParam param) {
        return cashRecordService.save(param);

    }
}